package splab.ufcg.edu.br.trace.query.entities;

import java.io.Serializable;

public class QueryExpression implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6369542598946490341L;
	
	private QueryOperatorEnum operator;
	
	private String parameter;

	public QueryExpression(QueryOperatorEnum operator) {
		this.operator = operator;
	}

	public QueryExpression(String parameter) {
		this.parameter = parameter;
		this.operator = null;
	}

	public QueryExpression(QueryOperatorEnum operator, String parameter) {
		this.parameter = parameter;
		this.operator = operator;	
	}

	public QueryOperatorEnum getOperator() {
		return operator;
	}

	public void setOperator(QueryOperatorEnum operator) {
		this.operator = operator;
	}

	public String getParameter() {
		return parameter;
	}

	public void setParameter(String parameter) {
		this.parameter = parameter;
	}

	@Override
	public String toString(){
		
		StringBuilder str = new StringBuilder();
		
		if (operator != null) {
			str.append(" ");
			str.append(operator.toString());
		}
		
		if (parameter != null) {
			str.append(" ");
			str.append(parameter);
		}
		
		
		return str.toString();
		
	}
	
	
}
